//
//  NYExamineTestTimeHeaderView.m
//  NiuWaJiaoYu
//
//  Created by 袁航 on 2018/1/9.
//  Copyright © 2018年 niuwaketang. All rights reserved.
//

#import "NYExamineTestTimeHeaderView.h"

@interface NYExamineTestTimeHeaderView ()

@end
@implementation NYExamineTestTimeHeaderView
- (void)setTestListModel:(NYExamineTestListModel *)testListModel
{
        _testListModel = testListModel;
//        [self.timerLabel set:testListModel.ex_usedtime.integerValue * 60];
        [self.timerLabel start];
}

- (void)setupView
{
        [super setupView];
        [self addSubview:self.timerLabel];
        [self.timerLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
                make.edges.equalTo(self);
        }];
}

- (MZTimerLabel *)timerLabel
{
        if (_timerLabel == nil) {
                _timerLabel = [[MZTimerLabel alloc] initWithTimerType:(MZTimerLabelTypeStopWatch)];
                _timerLabel.timeFormat = @"HH:mm:ss";
                _timerLabel.timeLabel.textColor = UIColorHex(0x3696FF);
                _timerLabel.enabled = NO;
                NSDictionary* attributesForRange = @{
                                                     NSForegroundColorAttributeName: UIColorHex(0x3696FF),
                                                     NSFontAttributeName : WGSystem14Font
                                                     };
                NSString *text = @"用时 \n00:00:00";
                NSRange r = [text rangeOfString:@"00:00:00"];
                _timerLabel.text = text;
                _timerLabel.textRange = r;
                _timerLabel.attributedDictionaryForTextInRange = attributesForRange;
                _timerLabel.font = WGSystem12Font;
                _timerLabel.numberOfLines = 2;
                _timerLabel.timeLabel.textColor = UIColorHex(0x3696FF);
                _timerLabel.timeLabel.font = WGSystem12Font;
                _timerLabel.timeLabel.numberOfLines = 2;
                _timerLabel.timeLabel.textAlignment = NSTextAlignmentCenter;
                _timerLabel.textAlignment = NSTextAlignmentCenter;
                _timerLabel.textColor = UIColorHex(0x3696FF);
                _timerLabel.resetTimerAfterFinish = YES;
                _timerLabel.backgroundColor = UIColorHex(0xE3F0FF);
        }
        return _timerLabel;
}
@end
